[% setvar title More defaulting to $_ %]
<div id="archive-notice">
    <h3>This file is part of the Perl 6 Archive</h3>
    <p>To see what is currently happening visit <a href="http://www.perl6.org/">http://www.perl6.org/</a></p>
</div>
<div class='pod'>
<a name='TITLE'></a><h1>TITLE</h1>
<p>More defaulting to $_</p>
<a name='VERSION'></a><h1>VERSION</h1>
<pre>  Maintainer: Kenneth C. Rich &lt;<a href='mailto:xkenrich@mail.rochester.edu'>xkenrich@mail.rochester.edu</a>&gt;
  Date: 10 Sep 2000
  Last Modified: 13 Sep 2000
  Mailing List: <a href='mailto:perl6-language@perl.org'>perl6-language@perl.org</a>
  Number: 215
  Version: 2
  Status: Developing</pre>
<a name='ABSTRACT'></a><h1>ABSTRACT</h1>
<p><code>$_</code> is the default variable for some operations and functions.
Other operations would benefit from similar use of
<code>$_</code> to reduce clutter.</p>
<a name='DESCRIPTION'></a><h1>DESCRIPTION</h1>
<p>$_ is the default scalar for a small set of operations and functions.
Most of these operations and functions are ones that use <code>=~</code>.
If we decouple <code>$_</code> from <code>=~</code>, then can we profitably use <code>$_</code> elsewhere?</p>
<a name='1: For &lt;&gt;'></a><h2>1: For &lt;&gt;</h2>
<p>An inconsistency between &quot;<code>print</code>&quot; and &quot;&lt;&gt;&quot; bugs me:  &quot;<code>print;</code>&quot; means
&quot;<code>print $_;</code>&quot; so it seems like &quot;&lt;&gt;&quot; should mean &quot;<code>$_ = </code> &lt;&gt;&quot;.
This would break code prompting for &quot;Press any key&quot; and wasting the
input.</p>
<p>Would this have an advantage in making the</p>
<pre> while( &lt;&gt; ) {
 }</pre>
<p>construction less magical?</p>
<p>Actually, some days I wish &quot;<code>print;</code>&quot; meant &quot;print nothing.&quot;  I was tempted
to title this RFC &quot;Make <code>print</code> and &lt;&gt; consistent.&quot;</p>
<p>Problem:
since &lt;&gt; has a different behavior in a list context, does
&quot;<code>(</code> &lt;&gt; <code>);</code>&quot; break, or does it mean something like &quot;<code>@_ =</code> &lt;&gt;c&lt;;&gt;&quot; ?</p>
<a name='2: For List Functions'></a><h2>2: For List Functions</h2>
<p>I also would like making &quot;<code>push;</code>&quot; mean <code>&quot;push( @_, $_ );</code>&quot; and
&quot;<code>pop;</code>&quot; mean &quot;<code>$_ = pop;</code>&quot; but I <b>can</b> think of code this would
break.  The same wish and problem applies to other list operators.  But
maybe the problems are easily fixed with the 5-to-6 converter changing
perl5 &quot;<code>pop;</code>&quot; into &quot;<code>undef = pop;</code>&quot; etc.  Which ugliness is more
preferable?  I like the idea of a &quot;wasting&quot; <code>pop</code> or <code>shift</code>
looking explicitly wasteful, at least some days.  I am not taking an
assertive stance on this shaky sub-proposal.</p>
<a name='3: For Functions In General'></a><h2>3: For Functions In General</h2>
<p>&quot;<code>stat</code>;&quot;, &quot;<code>length;</code>&quot;, and many others could use <code>$_</code>.  The
downside I see is that the parser gets bigger.</p>
<a name='And So On:'></a><h2>And So On:</h2>
<p>Parts of this proposal may work nicely with
RFC 170: &quot;Generalize =~ to a special-purpose assignment operator&quot;.</p>
<a name='IMPLEMENTATION'></a><h1>IMPLEMENTATION</h1>
<p>...</p>
<a name='REFERENCES'></a><h1>REFERENCES</h1>
<p>RFC 2: Request for new pragma: Implicit</p>
<p>RFC 51: Angle brackets should accept filenames and lists</p>
<p>RFC 56: Optional 2nd argument to pop() and shift()</p>
<p>RFC 139: Allow Calling Any Function With a Syntax Like s///</p>
<p>RFC 164: Replace =~, !_, m//, s///, and tr// with match(), subst(), and trade()</p>
<p>RFC 170: Generalize =~ to a special-purpose assignment operator</p>
</div>
